<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>盒子模型</title>
  <style>
    #d1{
      overflow: hidden;
      width: 100px;
      height: 100px;
      margin-top: 20px;
      margin-left: 20px;
      background-color: red;
    }
    #d1>div{
      width: 50px;
      height: 50px;
      margin-top: 25px;
      margin-left: 25px;
      background-color: blue;
    }
    #d2{
      /*添加此样式后给元素添加边框和内边距则不再影响元素的宽高*/
      box-sizing: border-box;
      margin-left: 120px;
      width: 110px;
      height: 110px;
      border: 5px solid green;
      border-radius: 5px;
      padding-top: 50px;
      padding-left: 50px;
    }
  </style>
</head>
<body>
<div id="d1">
  <div></div>
</div>
<div id="d2">哈喽</div>
</body>
</html>